import { SmsService } from './../services/sms.service';
import { Processor, WorkerHost } from '@nestjs/bullmq';
import { Job } from 'bullmq';

@Processor('sms')
export class SmsConsumer extends WorkerHost {
  constructor(private readonly smsService: SmsService) {
    super();
  }
  process(job: Job, token?: string): Promise<any> {
    const { phone, template, params } = job.data;
    this.smsService.send(phone, template, params);
  }
}
